<template>
  <div class="footer">
    <p>共{{ goodsList.length }}件商品,</p>
    <span class="allprice">合计: ￥{{ allPrice.toFixed(2) }}</span>
    <span class="finished" @click="finished">结算</span>
  </div>
</template>

<script>
import { mapState, mapGetters, mapMutations } from "vuex";
export default {
  methods: {
    add() {
      console.log(111);
    },
    ...mapMutations(["finished"]),
  },
  computed: {
    ...mapState(["goodsList"]),
    ...mapGetters(["allPrice"]),
  },
};
</script>

<style lang="scss" scoped>
.footer {
  display: flex;
  height: 100px;
  font-size: 30px;
  padding: 20px;
  line-height: 60px;
  justify-content: center;
  align-items: center;

  p {
    margin-right: 10px;
  }

  .allprice {
    color: tomato;
  }

  .finished {
    width: 110px;
    background: green;
    height: 40px;
    line-height: 40px;
    text-align: center;
    color: #fff;
    font-size: 24px;
    border-radius: 20px;
    margin-left: 30px;
  }
}
</style>
